package com.eoner.middlelib.eventbus;

import com.eoner.middlelib.eventbus.event.AgreePrivacyEvent;
import com.eoner.middlelib.eventbus.event.HomeMessageRedEvent;
import com.eoner.middlelib.eventbus.event.HomeRefreshEvent;
import com.eoner.middlelib.eventbus.event.LiveCloseShowEvent;
import com.eoner.middlelib.eventbus.event.LoginSuccessEvent;
import com.eoner.middlelib.eventbus.event.SignRefreshEvent;

import org.greenrobot.eventbus.EventBus;

public class EventBusManager {


    /**
    * 注册通知
    * */
    public static void register(Object subscriber) {
        EventBus.getDefault().register(subscriber);
    }

    /**
    * 解除通知
    * */
    public static void unRegister(Object subscriber) {
        EventBus.getDefault().unregister(subscriber);
    }

    /**
    * 发送通知
    * */
    public static void post(Object object) {
        EventBus.getDefault().post(object);
    }

    /////////////////////////////////////////////////////////////////////////////////
    //
    //                    通知事件
    //
    /////////////////////////////////////////////////////////////////////////////////

    /**
    * 首页刷新事件
    * */
    public static HomeRefreshEvent createHomeRefreshEvent() {
        HomeRefreshEvent event = new HomeRefreshEvent();
        return event;
    }

    /**
    * 首页消息红点
    * */
    public static HomeMessageRedEvent createHomeMessageRedEvent(int num) {
        HomeMessageRedEvent event = new HomeMessageRedEvent();
        event.setNoticeNum(num);
        return event;
    }

    /**
     * 签到成功事件
     * */
    public static SignRefreshEvent createSignRefreshEvent() {
        return new SignRefreshEvent();
    }

    /**
    * 登录成功事件
    * */
    public static LoginSuccessEvent createLoginSuccessEvent() {
        return new LoginSuccessEvent();
    }

    /**
    * 同意隐私协议
    * */
    public static AgreePrivacyEvent createAgreePrivacyEvent() {
        return new AgreePrivacyEvent();
    }

    /**
     * 直播间关闭按钮是否显示
     * */
    public static LiveCloseShowEvent createLiveCloseShowEvent(boolean isShow) {
        LiveCloseShowEvent event = new LiveCloseShowEvent();
        event.setShow(isShow);
        return event;
    }

}
